﻿#include "RBTree.h"
#include <vector>


void TestRBTree1()
{
	RBTree<int, int> t;
	// 常规的测试用例
	//int a[] = { 5,22,19,81,12,56,4,26,60,92};
	// 带有双旋场景的测试用例
	int a[] = { 10, 5, 15, 3, 7, 12, 17, 2, 4, 6 };
	
	for (auto e : a)
	{
		t.Insert({ e, e });
	}
	t.InOrder();
	cout << t.IsBalanceTree() << endl;
}
void TestRBTree2()
{
	const int N = 1000000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));

	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand() + i);
	}


	RBTree<int, int> t;
	for (auto e : v)
	{
		t.Insert({ e, e });
	}

	cout << t.IsBalanceTree() << endl;

}


int main()
{
	//TestRBTree1();
	TestRBTree2();

	return 0;
}